<?php
/**
 * Created by PhpStorm.
 * User: macmini
 * Date: 2018/2/28
 * Time: 下午3:09
 */

namespace app\common\model;

use think\Model;

class Orders extends Model
{
    protected function getUserNameAttr($value, $data)
    {
        $user_name = model('Users')->where('id', $data['user_id'])->value('username');
        return $user_name;
    }
    protected function getStatusAttr($value)
    {
        $status = [0 => '未支付', 1 => '已支付', 2 => '已取消'];
        return ['val' => $value, 'text' => $status[$value]];
    }
}
